//
//  ViewController.m
//  ShiWuPai
//
//  Created by macmacpro on 16/11/22.
//  Copyright (c) 2016年 QQ:244987427. All rights reserved.
//

#import "ViewController.h"
#import "GuangChiViewController.h"
#import "EncyclopediaViewController.h"
#import "PersonalViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [NSThread sleepForTimeInterval:1.0];   //设置进程停止1秒
    
    [self setViewCtrls];
    
}


#pragma mark -getter and setter

- (instancetype)init{
    self = [super init];
    if (self) {
        UITabBarItem *tabBarItem = [UITabBarItem appearance];
        [tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor colorWithRed:250/255.0 green:94/255.0 blue:94/255.0 alpha:1]} forState:UIControlStateSelected];
    }
    return self;
}

#pragma mark -custom method?

- (void)setViewCtrls{
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
    
    EncyclopediaViewController *encyclopedDiaCtr = [EncyclopediaViewController new];
    UINavigationController *encyclopedDiaNav = [[UINavigationController alloc] initWithRootViewController:encyclopedDiaCtr];
    encyclopedDiaNav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"食物百科" image:[[UIImage imageNamed:@"ic_tab_search_30x30_@2x.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"ic_tab_search_select_30x30_@2x.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    GuangChiViewController *guangChiViewCtr = [GuangChiViewController new];
    UINavigationController *guangChiNav = [[UINavigationController alloc] initWithRootViewController:guangChiViewCtr];
    
    guangChiNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"逛吃" image:[[UIImage imageNamed:@"ic_tab_homepage_30x30_@2x.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"ic_tab_homepage_select_30x30_@2x.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    PersonalViewController *personalCtr = [sb instantiateViewControllerWithIdentifier:@"PersonList"];
    UINavigationController *personalNav = [[UINavigationController alloc] initWithRootViewController:personalCtr];
    personalNav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"我的" image:[[UIImage imageNamed:@"ic_tab_my_30x30_@2x.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"ic_tab_my_select_30x30_@2x.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    [self setViewControllers:@[encyclopedDiaNav,guangChiNav,personalNav]];
    
}









@end
